import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayTypeVO, PayTypeForm, PayTypeQuery } from '@/api/system/PayType/types';

/**
 * 查询支付平台列表
 * @param query
 * @returns {*}
 */

export const listPayType = (query?: PayTypeQuery): AxiosPromise<PayTypeVO[]> => {
  return request({
    url: '/system/PayType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询支付平台详细
 * @param typeId
 */
export const getPayType = (typeId: string | number): AxiosPromise<PayTypeVO> => {
  return request({
    url: '/system/PayType/' + typeId,
    method: 'get'
  });
};

/**
 * 新增支付平台
 * @param data
 */
export const addPayType = (data: PayTypeForm) => {
  return request({
    url: '/system/PayType',
    method: 'post',
    data: data
  });
};

/**
 * 修改支付平台
 * @param data
 */
export const updatePayType = (data: PayTypeForm) => {
  return request({
    url: '/system/PayType',
    method: 'put',
    data: data
  });
};

/**
 * 删除支付平台
 * @param typeId
 */
export const delPayType = (typeId: string | number | Array<string | number>) => {
  return request({
    url: '/system/PayType/' + typeId,
    method: 'delete'
  });
};


/**
 * 查询收款方式
 */
export const selecTypetList = () => {
  return request({
    url: '/system/PayType/selectList',
    method: 'get'
  });
};